import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';
export namespace PerFamilyMarriageApi {
  /** 移居国外信息信息 */
  export interface FamilyMarriage {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    relation: string; // 与本人关系（称谓）
    systemPersonId: number; // 系统人员ID，对应 system_person.id
    familyName: string; // 配偶姓名
    cardType: string; // 证件类型
    familyIdcard: string; // 配偶身份证号
    country: string; // 国籍地区
    workUnit: string; // 工作学习单位
    position: string; // 职务
    registrationTime: string | Dayjs; // 登记时间
    residenceAfterMarriage: string; // 婚后居住地
    status: number; // 状态（1：有效，0：无效）
  }
}

/** 查询移居国外信息分页 */
export function getFamilyMarriagePage(
  data: PageParam,
  desensitize: boolean,
  encrypt: boolean,
) {
  return requestClient.post<PageResult<PerFamilyMarriageApi.FamilyMarriage>>(
    '/per/family-marriage/page',
    data,
    { desensitize, encrypt },
  );
}

/** 查询移居国外信息详情 */
export function getFamilyMarriage(id: number) {
  return requestClient.get<PerFamilyMarriageApi.FamilyMarriage>(
    `/per/family-marriage/get?id=${id}`,
  );
}

/** 新增移居国外信息 */
export function createFamilyMarriage(
  data: PerFamilyMarriageApi.FamilyMarriage,
) {
  return requestClient.post('/per/family-marriage/create', data);
}

/** 修改移居国外信息 */
export function updateFamilyMarriage(
  data: PerFamilyMarriageApi.FamilyMarriage,
) {
  return requestClient.put('/per/family-marriage/update', data);
}

/** 删除移居国外信息 */
export function deleteFamilyMarriage(id: number) {
  return requestClient.delete(`/per/family-marriage/delete?id=${id}`);
}

/** 批量删除移居国外信息 */
export function deleteFamilyMarriageList(ids: number[]) {
  return requestClient.delete(
    `/per/family-marriage/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出移居国外信息 */
export function exportFamilyMarriage(params: any) {
  return requestClient.download('/per/family-marriage/export-excel', {
    params,
  });
}
